#include <stdio.h>
#include <pthread.h>
#include <errno.h>
#include <stdlib.h>
#include <e_file.h>
#include <string.h>

//让工作线程5s钟之后终止
static void *new_thr_job (void *s)
{
	int i = 0;
	while (1) {
		if (i++ >= 5) {
			break;
		}
		write (1, "!", 1);
		sleep (1);
	}
	return NULL;
}

int main (void)
{
	pthread_t tid;
	int err;
	//创建一个新线程
	if (err = pthread_create (&tid, NULL, new_thr_job, NULL))
	{
		fprintf (stderr, "pthread_create():%s\n", strerror(err));
		exit(1);
	}
	while (1) 
	{
		write (1, "*", 1);
		sleep (1);
	}
	return 0;
}
